<template>
  <div>
    <keep-alive>
      <router-view></router-view>
    </keep-alive>

    <van-tabbar placeholder route  v-model="active" border>
<!-- 习惯用replace   正常的是逻辑是需要加的  -->
      <van-tabbar-item replace  to="/home">
        <span>电影</span>
        <template #icon="props">
          <!-- <img :src="props.active ? icon.active : icon.inactive" /> -->
          <!-- {{props.active}} -->
          <svg class="xl-icon" aria-hidden="true">
            <use xlink:href="#icon-dianyingpiao"></use>
          </svg> 
        </template>
      </van-tabbar-item>
      <van-tabbar-item  replace to="/goods">
        <span>商品</span>
        <template #icon="props">
         <!-- {{props.active}} -->
          <!-- <img :src="props.active ? icon.active : icon.inactive" /> -->
          <svg class="xl-icon" aria-hidden="true">
            <use xlink:href="#icon-goods-copy"></use>
          </svg>
        </template>
      </van-tabbar-item>
      <van-tabbar-item replace to="/my">
        <span>我的</span>
        <template #icon="props">
          <!-- <img :src="props.active ? icon.active : icon.inactive" /> -->
          <svg class="xl-icon" aria-hidden="true">
            <use xlink:href="#icon-yonghu"></use>
          </svg>
        </template>
      </van-tabbar-item>


    </van-tabbar>
  </div>
</template>

<script>
import { Tabbar, TabbarItem } from "vant";
export default {
  name: "index",
  components: {
    [Tabbar.name]: Tabbar,
    [TabbarItem.name]: TabbarItem,
  },
  data() {
    return {
      active: 0,
    };
  },
};
</script>

<style>
</style>